<?php
// +----------------------------------------------------------------------
// | ZGUAN [ 致力于帮助更多的中小企业实现低成本数字化转型 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2024 https://www.zguan.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ZGUAN 并不是自由软件，未经许可不能去掉ZGUAN 相关版权
// +----------------------------------------------------------------------
// | Author: ZGUAN Team <admin@zguan.cn>  0769-82282996  15899929162
// +----------------------------------------------------------------------
namespace app\controller\property\system;

use think\App;
use app\controller\property\Base;
use app\common\services\UploadService;
use app\common\repositories\system\SystemConfigRepository;

class SystemConfig extends Base
{
    protected $repository;

    public function __construct(App $app, SystemConfigRepository $repository)
    {
        parent::__construct($app);
        $this->repository = $repository;
    }

    /**
     * 应用设置
     *
     * @return string|\think\response\Json
     * @throws \Exception
     */
    public function programInfo()
    {
        if ($this->request->isPost()) {
            $this->repository->modifyConfig('program', $this->request->post(), $this->request->propertyId);
            return json()->data(['code' => 0, 'msg' => '修改成功']);
        } else {
            return $this->fetch('system/config/program_info', [
                'info' => $this->repository->getConfig($this->request->propertyId, 'program')
            ]);
        }
    }

}